package cn.bugstack.mybatis.mapping;

import java.util.Map;

import cn.bugstack.mybatis.session.Configuration;

/**
 * description: 映射语句类
 * taskId：
 * <pre>
 * change history:
 * date             defect#             person                comments
 * ---------------------------------------------------------------------
 * 2024/11/25       ********         zhaochaoyue        create file
 * </pre>
 *
 * @author: zhaochaoyue
 * @date: 2024/11/25 16:36
 * @copyright: 2024
 */
public class MappedStatement {

    

    private Configuration configuration;
    
    private String id;
    
    //操作类型 sql指令类型
    private SqlCommandType commandType;
    
    private BoundSql boundSql;
    

    public MappedStatement() {
    }

    public Configuration getConfiguration() {
        return configuration;
    }

    public void setConfiguration(Configuration configuration) {
        this.configuration = configuration;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public SqlCommandType getCommandType() {
        return commandType;
    }

    public BoundSql getBoundSql() {
        return boundSql;
    }

    /**
     * 建造者
     */
    public static class Builder{
        private MappedStatement mappedStatement = new MappedStatement();
        
        
        public Builder(Configuration configuration, String id, SqlCommandType commandType, 
            BoundSql boundSql) {
            mappedStatement.configuration = configuration;
            mappedStatement.id = id;
            mappedStatement.commandType = commandType;
            mappedStatement.boundSql =boundSql;
            
        }
        
        public MappedStatement build(){
            assert mappedStatement.configuration !=null;
            assert mappedStatement.id != null;
            return mappedStatement;
        }
        
    }
}
